package com.byit.utils;

import lombok.extern.slf4j.Slf4j;

/**
 * 文件工具类
 *
 * @author wangx
 */
@Slf4j
public class FileTools {

    /**
     * 文本文件UTF-8编码
     */
    public static final String FILE_CHARACTER_UTF8 = "UTF-8";


    private FileTools() {
        throw new IllegalStateException("Utility class");
    }

    /**
     * 获取文件名称后缀
     *
     * @param path
     * @return 后缀
     */
    public static String getSuffix(String path) {
        if (path.lastIndexOf(".") != -1 && path.lastIndexOf(".") != 0) {
            return path.substring(path.lastIndexOf(".") + 1);
        } else {
            return "";
        }
    }


}
